/*
 * XIntShell.java
 *
 * Created on Jun 23, 2009, 9:20:52 PM
 */
package professorGUI;

import cayenne.DBobjects.Category;
import cayenne.DBobjects.Student;
import cayenne.DBobjects.Problem;
import cayenne.DBobjects.Professor;
import dynamic.CodeRunner;
import java.awt.Color;
import java.util.Arrays;
import xidb.convert.*;
import java.util.List;
import java.util.Vector;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

/**
 *
 * @author radu
 */
public class XIntShell extends javax.swing.JFrame {

    /** Creates new form XIntShell */
    public XIntShell() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;
        bindingGroup = new org.jdesktop.beansbinding.BindingGroup();

        databaseManager = new xidb.DBManager();
        logInDialog = new javax.swing.JDialog();
        usernameLBL = new javax.swing.JLabel();
        passwordLBL = new javax.swing.JLabel();
        usernameTF = new javax.swing.JTextField();
        passwordPF = new javax.swing.JPasswordField();
        logInBTN = new javax.swing.JButton();
        logInStatusLBL = new javax.swing.JLabel();
        attemptController = new xidb.AttemptController();
        tabs = new javax.swing.JTabbedPane();
        scpTabPNL = new javax.swing.JPanel();
        studentInfoPNL = new javax.swing.JPanel();
        studentFirstNameTF = new javax.swing.JTextField();
        studentLastNameTF = new javax.swing.JTextField();
        studentUserNameTF = new javax.swing.JTextField();
        studentFirstNameLBL = new javax.swing.JLabel();
        studentLastNameLBL = new javax.swing.JLabel();
        studentUserNameLBL = new javax.swing.JLabel();
        studentAddDeletePNL = new javax.swing.JPanel();
        studentAddBTN = new javax.swing.JButton();
        studentDeleteBTN = new javax.swing.JButton();
        studentListSP = new javax.swing.JScrollPane();
        studentList = new javax.swing.JList();
        professorInfoPNL = new javax.swing.JPanel();
        professorFirstNameLBL = new javax.swing.JLabel();
        professorLastNameLBL = new javax.swing.JLabel();
        professorFirstNameTF = new javax.swing.JTextField();
        professorLastNameTF = new javax.swing.JTextField();
        professorAddDeletePNL = new javax.swing.JPanel();
        professorAddBTN = new javax.swing.JButton();
        professorDeleteBTN = new javax.swing.JButton();
        professorUserNameLBL = new javax.swing.JLabel();
        professorUserNameTF = new javax.swing.JTextField();
        professorListSP = new javax.swing.JScrollPane();
        professorList = new javax.swing.JList();
        categoryInfoPNL = new javax.swing.JPanel();
        categoryNameLBL = new javax.swing.JLabel();
        categoryNameTF = new javax.swing.JTextField();
        categoryDescriptionSP = new javax.swing.JScrollPane();
        categoryDescriptionTA = new javax.swing.JTextArea();
        categoryAddDeletePNL = new javax.swing.JPanel();
        categoryAddBTN = new javax.swing.JButton();
        categoryDeleteBTN = new javax.swing.JButton();
        categoryListSP = new javax.swing.JScrollPane();
        categoryList = new javax.swing.JList();
        problemsTabPNL = new javax.swing.JPanel();
        problemInfoPNL = new javax.swing.JPanel();
        titleLBL = new javax.swing.JLabel();
        categoryLBL = new javax.swing.JLabel();
        authorLBL = new javax.swing.JLabel();
        titleTF = new javax.swing.JTextField();
        categoryCB = new javax.swing.JComboBox();
        authorCB = new javax.swing.JComboBox();
        problemAddDeletePNL = new javax.swing.JPanel();
        problemAddBTN = new javax.swing.JButton();
        problemDeleteBTN = new javax.swing.JButton();
        problemListSP = new javax.swing.JScrollPane();
        problemList = new javax.swing.JList();
        descriptionSP = new javax.swing.JScrollPane();
        descriptionTA = new javax.swing.JTextArea();
        upperCodeSP = new javax.swing.JScrollPane();
        upperCodeTA = new javax.swing.JTextArea();
        lowerCodeSP = new javax.swing.JScrollPane();
        lowerCodeTA = new javax.swing.JTextArea();
        inputSP = new javax.swing.JScrollPane();
        inputTA = new javax.swing.JTextArea();
        outputSP = new javax.swing.JScrollPane();
        outputTA = new javax.swing.JTextArea();
        classesTabPNL = new javax.swing.JPanel();
        classInfoPNL = new javax.swing.JPanel();
        classTitleLBL = new javax.swing.JLabel();
        classSemesterLBL = new javax.swing.JLabel();
        classYearLBL = new javax.swing.JLabel();
        classTitleTF = new javax.swing.JTextField();
        classSemesterTF = new javax.swing.JTextField();
        classYearTF = new javax.swing.JTextField();
        classProfessorTF = new javax.swing.JLabel();
        classProfessorCB = new javax.swing.JComboBox();
        classesSP = new javax.swing.JScrollPane();
        classesList = new javax.swing.JList();
        classesAddBTN = new javax.swing.JButton();
        classesDeleteBTN = new javax.swing.JButton();
        availableProblemsPNL = new javax.swing.JPanel();
        problemCategoryCB = new javax.swing.JComboBox();
        problemsPoolSP = new javax.swing.JScrollPane();
        problemsPool = new javax.swing.JList();
        assignedProblemsSP = new javax.swing.JScrollPane();
        assignedProblems = new javax.swing.JList();
        assignProblemsBTN = new javax.swing.JButton();
        removeProblemsBTN = new javax.swing.JButton();
        studentsPoolSP = new javax.swing.JScrollPane();
        studentsPool = new javax.swing.JList();
        enrolledStudentsSP = new javax.swing.JScrollPane();
        enrolledStudents = new javax.swing.JList();
        enrollStudentsBTN = new javax.swing.JButton();
        removeStudentsBTN = new javax.swing.JButton();
        attemptTabPNL = new javax.swing.JPanel();
        attemptTabClassesSP = new javax.swing.JScrollPane();
        attemptTabClassesLST = new javax.swing.JList();
        attemptTabProblemsSP = new javax.swing.JScrollPane();
        attemptTabProblemsLST = new javax.swing.JList();
        attemptTabStudentsSP = new javax.swing.JScrollPane();
        attemptTabStudentsLST = new javax.swing.JList();
        attemptTabAttemptSP = new javax.swing.JScrollPane();
        attemptTabAttemptLST = new javax.swing.JList();
        attemptTabCodeSP = new javax.swing.JScrollPane();
        attemptTabCodeTA = new javax.swing.JTextArea();
        attemptTabCauseSP = new javax.swing.JScrollPane();
        attemptTabCauseTA = new javax.swing.JTextArea();
        configTabPNL = new javax.swing.JPanel();
        changePasswordPNL = new javax.swing.JPanel();
        newPassword2PF = new javax.swing.JPasswordField();
        newPasswordPF = new javax.swing.JPasswordField();
        currentPasswordPF = new javax.swing.JPasswordField();
        newPassword2LBL = new javax.swing.JLabel();
        newPasswordLBL = new javax.swing.JLabel();
        currentPasswordLBL = new javax.swing.JLabel();
        changePasswordBTN = new javax.swing.JButton();
        resetStudentPasswordPNL = new javax.swing.JPanel();
        resetPasswordBTN = new javax.swing.JButton();
        studentsSP = new javax.swing.JScrollPane();
        studentListLST = new javax.swing.JList();

        logInDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        logInDialog.setTitle("XInteract Professor Log In");
        logInDialog.setMinimumSize(new java.awt.Dimension(400, 200));
        logInDialog.setModal(true);
        logInDialog.addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosed(java.awt.event.WindowEvent evt) {
                logInDialogWindowClosed(evt);
            }
        });
        logInDialog.getContentPane().setLayout(new java.awt.GridBagLayout());

        usernameLBL.setText("Username:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        logInDialog.getContentPane().add(usernameLBL, gridBagConstraints);

        passwordLBL.setText("Password:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        logInDialog.getContentPane().add(passwordLBL, gridBagConstraints);

        usernameTF.setPreferredSize(new java.awt.Dimension(100, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        logInDialog.getContentPane().add(usernameTF, gridBagConstraints);

        passwordPF.setPreferredSize(new java.awt.Dimension(100, 25));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        logInDialog.getContentPane().add(passwordPF, gridBagConstraints);

        logInBTN.setText("Log In");
        logInBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                logInBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        logInDialog.getContentPane().add(logInBTN, gridBagConstraints);

        logInStatusLBL.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        logInStatusLBL.setText("Please enter your credentials and press the log in button.");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        logInDialog.getContentPane().add(logInStatusLBL, gridBagConstraints);

        logInDialog.setVisible(true);

        org.jdesktop.beansbinding.Binding binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, attemptTabProblemsLST, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), attemptController, org.jdesktop.beansbinding.BeanProperty.create("problem"));
        bindingGroup.addBinding(binding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, attemptTabStudentsLST, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), attemptController, org.jdesktop.beansbinding.BeanProperty.create("student"));
        bindingGroup.addBinding(binding);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("XInteract Professor");
        setMinimumSize(new java.awt.Dimension(600, 600));
        getContentPane().setLayout(new java.awt.GridBagLayout());

        tabs.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                tabsStateChanged(evt);
            }
        });

        scpTabPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        scpTabPNL.setLayout(new java.awt.GridBagLayout());

        studentInfoPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Student Info"));
        studentInfoPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        studentInfoPNL.setLayout(new java.awt.GridBagLayout());

        studentFirstNameTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, studentList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), studentFirstNameTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A STUDENT]");
        binding.setConverter(new StudentFirstNameConverter());
        bindingGroup.addBinding(binding);

        studentFirstNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                studentFirstNameTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                studentFirstNameTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        studentInfoPNL.add(studentFirstNameTF, gridBagConstraints);

        studentLastNameTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, studentList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), studentLastNameTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A STUDENT]");
        binding.setConverter(new StudentLastNameConverter());
        bindingGroup.addBinding(binding);

        studentLastNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                studentLastNameTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                studentLastNameTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        studentInfoPNL.add(studentLastNameTF, gridBagConstraints);

        studentUserNameTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, studentList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), studentUserNameTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A STUDENT]");
        binding.setConverter(new StudentUserNameConverter());
        bindingGroup.addBinding(binding);

        studentUserNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                studentUserNameTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                studentUserNameTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        studentInfoPNL.add(studentUserNameTF, gridBagConstraints);

        studentFirstNameLBL.setText("First Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        studentInfoPNL.add(studentFirstNameLBL, gridBagConstraints);

        studentLastNameLBL.setText("Last Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        studentInfoPNL.add(studentLastNameLBL, gridBagConstraints);

        studentUserNameLBL.setText("User Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        studentInfoPNL.add(studentUserNameLBL, gridBagConstraints);

        studentAddDeletePNL.setLayout(new java.awt.GridLayout(1, 0));

        studentAddBTN.setText("Add");
        studentAddBTN.setEnabled(false);
        studentAddBTN.setFocusable(false);
        studentAddBTN.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        studentAddBTN.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        studentAddBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                studentAddBTNActionPerformed(evt);
            }
        });
        studentAddDeletePNL.add(studentAddBTN);

        studentDeleteBTN.setText("Delete");
        studentDeleteBTN.setEnabled(false);
        studentDeleteBTN.setFocusable(false);
        studentDeleteBTN.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        studentDeleteBTN.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        studentDeleteBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                studentDeleteBTNActionPerformed(evt);
            }
        });
        studentAddDeletePNL.add(studentDeleteBTN);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        studentInfoPNL.add(studentAddDeletePNL, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        scpTabPNL.add(studentInfoPNL, gridBagConstraints);

        studentListSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Students"));
        studentListSP.setPreferredSize(new java.awt.Dimension(250, 200));

        studentList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        org.jdesktop.beansbinding.ELProperty eLProperty = org.jdesktop.beansbinding.ELProperty.create("${students}");
        org.jdesktop.swingbinding.JListBinding jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, studentList);
        bindingGroup.addBinding(jListBinding);

        studentList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                studentListValueChanged(evt);
            }
        });
        studentListSP.setViewportView(studentList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        scpTabPNL.add(studentListSP, gridBagConstraints);

        professorInfoPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Professor Info"));
        professorInfoPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        professorInfoPNL.setLayout(new java.awt.GridBagLayout());

        professorFirstNameLBL.setText("First Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        professorInfoPNL.add(professorFirstNameLBL, gridBagConstraints);

        professorLastNameLBL.setText("Last Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        professorInfoPNL.add(professorLastNameLBL, gridBagConstraints);

        professorFirstNameTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, professorList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), professorFirstNameTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A PROFESSOR]");
        binding.setConverter(new ProfessorFirstNameConverter());
        bindingGroup.addBinding(binding);

        professorFirstNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                professorFirstNameTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                professorFirstNameTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        professorInfoPNL.add(professorFirstNameTF, gridBagConstraints);

        professorLastNameTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, professorList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), professorLastNameTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A PROFESSOR]");
        binding.setConverter(new ProfessorLastNameConverter());
        bindingGroup.addBinding(binding);

        professorLastNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                professorLastNameTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                professorLastNameTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        professorInfoPNL.add(professorLastNameTF, gridBagConstraints);

        professorAddDeletePNL.setLayout(new java.awt.GridLayout(1, 0));

        professorAddBTN.setText("Add");
        professorAddBTN.setEnabled(false);
        professorAddBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                professorAddBTNActionPerformed(evt);
            }
        });
        professorAddDeletePNL.add(professorAddBTN);

        professorDeleteBTN.setText("Delete");
        professorDeleteBTN.setEnabled(false);
        professorDeleteBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                professorDeleteBTNActionPerformed(evt);
            }
        });
        professorAddDeletePNL.add(professorDeleteBTN);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        professorInfoPNL.add(professorAddDeletePNL, gridBagConstraints);

        professorUserNameLBL.setText("User Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        professorInfoPNL.add(professorUserNameLBL, gridBagConstraints);

        professorUserNameTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, professorList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), professorUserNameTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A PROFESSOR]");
        binding.setConverter(new ProfessorUserNameConverter());
        bindingGroup.addBinding(binding);

        professorUserNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                professorUserNameTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                professorUserNameTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        professorInfoPNL.add(professorUserNameTF, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        scpTabPNL.add(professorInfoPNL, gridBagConstraints);

        professorListSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Professors"));
        professorListSP.setPreferredSize(new java.awt.Dimension(250, 200));

        professorList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${professors}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, professorList);
        bindingGroup.addBinding(jListBinding);

        professorList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                professorListValueChanged(evt);
            }
        });
        professorListSP.setViewportView(professorList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        scpTabPNL.add(professorListSP, gridBagConstraints);

        categoryInfoPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Category Info"));
        categoryInfoPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        categoryInfoPNL.setLayout(new java.awt.GridBagLayout());

        categoryNameLBL.setText("Name:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        categoryInfoPNL.add(categoryNameLBL, gridBagConstraints);

        categoryNameTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, categoryList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), categoryNameTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A CATEGORY]");
        binding.setConverter(new CategoryNameConverter());
        bindingGroup.addBinding(binding);

        categoryNameTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                categoryNameTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                categoryNameTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        categoryInfoPNL.add(categoryNameTF, gridBagConstraints);

        categoryDescriptionSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Description"));

        categoryDescriptionTA.setColumns(20);
        categoryDescriptionTA.setRows(4);
        categoryDescriptionTA.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, categoryList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), categoryDescriptionTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A CATEGORY]");
        binding.setConverter(new CategoryDescriptionConverter());
        bindingGroup.addBinding(binding);

        categoryDescriptionTA.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                categoryDescriptionTAFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                categoryDescriptionTAFocusLost(evt);
            }
        });
        categoryDescriptionSP.setViewportView(categoryDescriptionTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        categoryInfoPNL.add(categoryDescriptionSP, gridBagConstraints);

        categoryAddDeletePNL.setLayout(new java.awt.GridLayout(1, 0));

        categoryAddBTN.setText("Add");
        categoryAddBTN.setEnabled(false);
        categoryAddBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                categoryAddBTNActionPerformed(evt);
            }
        });
        categoryAddDeletePNL.add(categoryAddBTN);

        categoryDeleteBTN.setText("Delete");
        categoryDeleteBTN.setEnabled(false);
        categoryDeleteBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                categoryDeleteBTNActionPerformed(evt);
            }
        });
        categoryAddDeletePNL.add(categoryDeleteBTN);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        categoryInfoPNL.add(categoryAddDeletePNL, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        scpTabPNL.add(categoryInfoPNL, gridBagConstraints);

        categoryListSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Categories"));
        categoryListSP.setPreferredSize(new java.awt.Dimension(250, 200));

        categoryList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${categories}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, categoryList);
        bindingGroup.addBinding(jListBinding);

        categoryList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                categoryListValueChanged(evt);
            }
        });
        categoryListSP.setViewportView(categoryList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        scpTabPNL.add(categoryListSP, gridBagConstraints);

        tabs.addTab("Students | Categories | Professors", scpTabPNL);

        problemsTabPNL.setLayout(new java.awt.GridBagLayout());

        problemInfoPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Problem Info"));
        problemInfoPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        problemInfoPNL.setLayout(new java.awt.GridBagLayout());

        titleLBL.setText("Title:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemInfoPNL.add(titleLBL, gridBagConstraints);

        categoryLBL.setText("Category:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemInfoPNL.add(categoryLBL, gridBagConstraints);

        authorLBL.setText("Author:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemInfoPNL.add(authorLBL, gridBagConstraints);

        titleTF.setFocusable(false);
        titleTF.setPreferredSize(new java.awt.Dimension(100, 25));

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), titleTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("SELECT A PROBLEM");
        binding.setConverter(new ProblemTitleConverter());
        bindingGroup.addBinding(binding);

        titleTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                titleTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                titleTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemInfoPNL.add(titleTF, gridBagConstraints);

        categoryCB.setEnabled(false);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${categories}");
        org.jdesktop.swingbinding.JComboBoxBinding jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, categoryCB);
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement_IGNORE_ADJUSTING}"), categoryCB, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        binding.setConverter(new ProblemCategoryConverter());
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemInfoPNL.add(categoryCB, gridBagConstraints);

        authorCB.setEnabled(false);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${professors}");
        jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, authorCB);
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement_IGNORE_ADJUSTING}"), authorCB, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        binding.setConverter(new ProblemAuthorConverter());
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemInfoPNL.add(authorCB, gridBagConstraints);

        problemAddDeletePNL.setLayout(new java.awt.GridLayout(1, 0));

        problemAddBTN.setText("Add");
        problemAddBTN.setEnabled(false);
        problemAddBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                problemAddBTNActionPerformed(evt);
            }
        });
        problemAddDeletePNL.add(problemAddBTN);

        problemDeleteBTN.setText("Delete Problem");
        problemDeleteBTN.setEnabled(false);
        problemDeleteBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                problemDeleteBTNActionPerformed(evt);
            }
        });
        problemAddDeletePNL.add(problemDeleteBTN);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        problemInfoPNL.add(problemAddDeletePNL, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemsTabPNL.add(problemInfoPNL, gridBagConstraints);

        problemListSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Select a problem"));
        problemListSP.setPreferredSize(new java.awt.Dimension(250, 200));

        problemList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${problems}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, problemList);
        bindingGroup.addBinding(jListBinding);

        problemList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                problemListValueChanged(evt);
            }
        });
        problemListSP.setViewportView(problemList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemsTabPNL.add(problemListSP, gridBagConstraints);

        descriptionSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Description"));

        descriptionTA.setColumns(20);
        descriptionTA.setRows(6);
        descriptionTA.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), descriptionTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[ENTER PROBLEM DESCRIPTION]");
        binding.setConverter(new ProblemDescriptionConverter());
        bindingGroup.addBinding(binding);

        descriptionTA.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                descriptionTAFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                descriptionTAFocusLost(evt);
            }
        });
        descriptionSP.setViewportView(descriptionTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemsTabPNL.add(descriptionSP, gridBagConstraints);

        upperCodeSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Upper Code"));

        upperCodeTA.setColumns(20);
        upperCodeTA.setRows(6);
        upperCodeTA.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), upperCodeTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[ENTER PROBLEM UPPER CODE]");
        binding.setConverter(new ProblemUpperCodeConverter());
        bindingGroup.addBinding(binding);

        upperCodeTA.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                upperCodeTAFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                upperCodeTAFocusLost(evt);
            }
        });
        upperCodeSP.setViewportView(upperCodeTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemsTabPNL.add(upperCodeSP, gridBagConstraints);

        lowerCodeSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Lower Code"));

        lowerCodeTA.setColumns(20);
        lowerCodeTA.setRows(6);
        lowerCodeTA.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), lowerCodeTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[ENTER PROBLEM LOWER CODE]");
        binding.setConverter(new ProblemLowerCodeConverter());
        bindingGroup.addBinding(binding);

        lowerCodeTA.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                lowerCodeTAFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                lowerCodeTAFocusLost(evt);
            }
        });
        lowerCodeSP.setViewportView(lowerCodeTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemsTabPNL.add(lowerCodeSP, gridBagConstraints);

        inputSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Input"));
        inputSP.setPreferredSize(new java.awt.Dimension(250, 151));

        inputTA.setColumns(10);
        inputTA.setRows(8);
        inputTA.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), inputTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[ENTER PROBLEM INPUTS (OPTIONAL)]");
        binding.setConverter(new ProblemInputConverter());
        bindingGroup.addBinding(binding);

        inputTA.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                inputTAFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                inputTAFocusLost(evt);
            }
        });
        inputSP.setViewportView(inputTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemsTabPNL.add(inputSP, gridBagConstraints);

        outputSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Output"));
        outputSP.setPreferredSize(new java.awt.Dimension(250, 151));

        outputTA.setColumns(10);
        outputTA.setRows(8);
        outputTA.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), outputTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[ENTER PROBLEM OUTPUTS (OPTIONAL)]");
        binding.setConverter(new ProblemOutputConverter());
        bindingGroup.addBinding(binding);

        outputTA.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                outputTAFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                outputTAFocusLost(evt);
            }
        });
        outputSP.setViewportView(outputTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        problemsTabPNL.add(outputSP, gridBagConstraints);

        tabs.addTab("Problems", problemsTabPNL);

        classesTabPNL.setLayout(new java.awt.GridBagLayout());

        classInfoPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Class Info"));
        classInfoPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        classInfoPNL.setLayout(new java.awt.GridBagLayout());

        classTitleLBL.setText("Title:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classTitleLBL, gridBagConstraints);

        classSemesterLBL.setText("Semester:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classSemesterLBL, gridBagConstraints);

        classYearLBL.setText("Year:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classYearLBL, gridBagConstraints);

        classTitleTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, classesList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), classTitleTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A CLASS]");
        binding.setConverter(new ClassTitleConverter());
        bindingGroup.addBinding(binding);

        classTitleTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                classTitleTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                classTitleTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classTitleTF, gridBagConstraints);

        classSemesterTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, classesList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), classSemesterTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A CLASS]");
        binding.setConverter(new ClassSemesterConverter());
        bindingGroup.addBinding(binding);

        classSemesterTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                classSemesterTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                classSemesterTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classSemesterTF, gridBagConstraints);

        classYearTF.setFocusable(false);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, classesList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), classYearTF, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue("[SELECT A CLASS]");
        binding.setConverter(new ClassYearConverter());
        bindingGroup.addBinding(binding);

        classYearTF.addFocusListener(new java.awt.event.FocusAdapter() {
            public void focusGained(java.awt.event.FocusEvent evt) {
                classYearTFFocusGained(evt);
            }
            public void focusLost(java.awt.event.FocusEvent evt) {
                classYearTFFocusLost(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classYearTF, gridBagConstraints);

        classProfessorTF.setText("Professor:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classProfessorTF, gridBagConstraints);

        classProfessorCB.setEnabled(false);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${professors}");
        jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, classProfessorCB);
        bindingGroup.addBinding(jComboBoxBinding);
        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, classesList, org.jdesktop.beansbinding.ELProperty.create("${selectedElement_IGNORE_ADJUSTING}"), classProfessorCB, org.jdesktop.beansbinding.BeanProperty.create("selectedItem"));
        binding.setConverter(new ClassProfessorConverter());
        bindingGroup.addBinding(binding);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classInfoPNL.add(classProfessorCB, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(classInfoPNL, gridBagConstraints);

        classesSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Classes"));
        classesSP.setPreferredSize(new java.awt.Dimension(250, 200));

        classesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${classes}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, classesList);
        bindingGroup.addBinding(jListBinding);

        classesList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                classesListValueChanged(evt);
            }
        });
        classesSP.setViewportView(classesList);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(classesSP, gridBagConstraints);

        classesAddBTN.setText("Add");
        classesAddBTN.setEnabled(false);
        classesAddBTN.setPreferredSize(new java.awt.Dimension(250, 30));
        classesAddBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                classesAddBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(classesAddBTN, gridBagConstraints);

        classesDeleteBTN.setText("Delete");
        classesDeleteBTN.setEnabled(false);
        classesDeleteBTN.setPreferredSize(new java.awt.Dimension(250, 30));
        classesDeleteBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                classesDeleteBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(classesDeleteBTN, gridBagConstraints);

        availableProblemsPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Available Problems"));
        availableProblemsPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        availableProblemsPNL.setLayout(new javax.swing.BoxLayout(availableProblemsPNL, javax.swing.BoxLayout.PAGE_AXIS));

        problemCategoryCB.setPreferredSize(new java.awt.Dimension(240, 20));

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${categories}");
        jComboBoxBinding = org.jdesktop.swingbinding.SwingBindings.createJComboBoxBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, problemCategoryCB);
        bindingGroup.addBinding(jComboBoxBinding);

        availableProblemsPNL.add(problemCategoryCB);

        problemsPoolSP.setBorder(null);
        problemsPoolSP.setPreferredSize(new java.awt.Dimension(240, 160));

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedItem}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, problemCategoryCB, eLProperty, problemsPool);
        jListBinding.setConverter(new CategoryProblemConverter());
        bindingGroup.addBinding(jListBinding);

        problemsPoolSP.setViewportView(problemsPool);

        availableProblemsPNL.add(problemsPoolSP);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(availableProblemsPNL, gridBagConstraints);

        assignedProblemsSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Assigned Problems"));
        assignedProblemsSP.setPreferredSize(new java.awt.Dimension(250, 200));

        assignedProblems.setEnabled(false);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, classesList, eLProperty, assignedProblems);
        jListBinding.setConverter(new ClassAssignmentsConverter());
        bindingGroup.addBinding(jListBinding);

        assignedProblemsSP.setViewportView(assignedProblems);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(assignedProblemsSP, gridBagConstraints);

        assignProblemsBTN.setText("Assign");
        assignProblemsBTN.setEnabled(false);
        assignProblemsBTN.setPreferredSize(new java.awt.Dimension(250, 30));
        assignProblemsBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                assignProblemsBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(assignProblemsBTN, gridBagConstraints);

        removeProblemsBTN.setText("Remove");
        removeProblemsBTN.setEnabled(false);
        removeProblemsBTN.setPreferredSize(new java.awt.Dimension(250, 30));
        removeProblemsBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeProblemsBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(removeProblemsBTN, gridBagConstraints);

        studentsPoolSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Available Students"));
        studentsPoolSP.setPreferredSize(new java.awt.Dimension(250, 200));

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${students}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, studentsPool);
        bindingGroup.addBinding(jListBinding);

        studentsPoolSP.setViewportView(studentsPool);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(studentsPoolSP, gridBagConstraints);

        enrolledStudentsSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Enrolled Students"));
        enrolledStudentsSP.setPreferredSize(new java.awt.Dimension(250, 200));

        enrolledStudents.setEnabled(false);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, classesList, eLProperty, enrolledStudents);
        jListBinding.setConverter(new ClassEnrollmentConverter());
        bindingGroup.addBinding(jListBinding);

        enrolledStudentsSP.setViewportView(enrolledStudents);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(enrolledStudentsSP, gridBagConstraints);

        enrollStudentsBTN.setText("Enroll");
        enrollStudentsBTN.setEnabled(false);
        enrollStudentsBTN.setPreferredSize(new java.awt.Dimension(250, 30));
        enrollStudentsBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                enrollStudentsBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(enrollStudentsBTN, gridBagConstraints);

        removeStudentsBTN.setText("Remove");
        removeStudentsBTN.setEnabled(false);
        removeStudentsBTN.setPreferredSize(new java.awt.Dimension(250, 30));
        removeStudentsBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removeStudentsBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        classesTabPNL.add(removeStudentsBTN, gridBagConstraints);

        tabs.addTab("Classes", classesTabPNL);

        attemptTabPNL.setLayout(new java.awt.GridBagLayout());

        attemptTabClassesSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Class"));
        attemptTabClassesSP.setPreferredSize(new java.awt.Dimension(250, 200));

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${classes}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, attemptTabClassesLST);
        bindingGroup.addBinding(jListBinding);

        attemptTabClassesSP.setViewportView(attemptTabClassesLST);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        attemptTabPNL.add(attemptTabClassesSP, gridBagConstraints);

        attemptTabProblemsSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Problem"));
        attemptTabProblemsSP.setPreferredSize(new java.awt.Dimension(250, 200));

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, attemptTabClassesLST, eLProperty, attemptTabProblemsLST);
        jListBinding.setSourceNullValue(null);
        jListBinding.setConverter(new ClassAssignmentsConverter());
        bindingGroup.addBinding(jListBinding);

        attemptTabProblemsSP.setViewportView(attemptTabProblemsLST);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        attemptTabPNL.add(attemptTabProblemsSP, gridBagConstraints);

        attemptTabStudentsSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Student"));
        attemptTabStudentsSP.setPreferredSize(new java.awt.Dimension(250, 200));

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${selectedElement}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, attemptTabClassesLST, eLProperty, attemptTabStudentsLST);
        jListBinding.setSourceNullValue(null);
        jListBinding.setConverter(new ClassEnrollmentConverter());
        bindingGroup.addBinding(jListBinding);

        attemptTabStudentsLST.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                attemptTabStudentsLSTValueChanged(evt);
            }
        });
        attemptTabStudentsSP.setViewportView(attemptTabStudentsLST);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        attemptTabPNL.add(attemptTabStudentsSP, gridBagConstraints);

        attemptTabAttemptSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Attempts"));
        attemptTabAttemptSP.setPreferredSize(new java.awt.Dimension(250, 200));

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${attempts}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, attemptController, eLProperty, attemptTabAttemptLST);
        jListBinding.setSourceNullValue(null);
        bindingGroup.addBinding(jListBinding);

        attemptTabAttemptSP.setViewportView(attemptTabAttemptLST);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        attemptTabPNL.add(attemptTabAttemptSP, gridBagConstraints);

        attemptTabCodeSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Student Code"));
        attemptTabCodeSP.setPreferredSize(new java.awt.Dimension(250, 200));

        attemptTabCodeTA.setColumns(20);
        attemptTabCodeTA.setRows(5);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, attemptTabAttemptLST, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), attemptTabCodeTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue(null);
        binding.setConverter(new AttemptCodeConverter());
        bindingGroup.addBinding(binding);

        attemptTabCodeSP.setViewportView(attemptTabCodeTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        attemptTabPNL.add(attemptTabCodeSP, gridBagConstraints);

        attemptTabCauseSP.setBorder(javax.swing.BorderFactory.createTitledBorder("Result"));
        attemptTabCauseSP.setPreferredSize(new java.awt.Dimension(250, 200));

        attemptTabCauseTA.setColumns(20);
        attemptTabCauseTA.setRows(5);

        binding = org.jdesktop.beansbinding.Bindings.createAutoBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, attemptTabAttemptLST, org.jdesktop.beansbinding.ELProperty.create("${selectedElement}"), attemptTabCauseTA, org.jdesktop.beansbinding.BeanProperty.create("text"));
        binding.setSourceNullValue(null);
        binding.setConverter(new AttemptCauseConverter());
        bindingGroup.addBinding(binding);

        attemptTabCauseSP.setViewportView(attemptTabCauseTA);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        attemptTabPNL.add(attemptTabCauseSP, gridBagConstraints);

        tabs.addTab("Student Attempts", attemptTabPNL);

        configTabPNL.setPreferredSize(new java.awt.Dimension(250, 200));
        configTabPNL.setLayout(new java.awt.GridBagLayout());

        changePasswordPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Change my password"));
        changePasswordPNL.setLayout(new java.awt.GridBagLayout());
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        changePasswordPNL.add(newPassword2PF, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        changePasswordPNL.add(newPasswordPF, gridBagConstraints);
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        changePasswordPNL.add(currentPasswordPF, gridBagConstraints);

        newPassword2LBL.setText("Repeat New Password:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        changePasswordPNL.add(newPassword2LBL, gridBagConstraints);

        newPasswordLBL.setText("New Password:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        changePasswordPNL.add(newPasswordLBL, gridBagConstraints);

        currentPasswordLBL.setText("Current Password:");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        changePasswordPNL.add(currentPasswordLBL, gridBagConstraints);

        changePasswordBTN.setText("Change Password");
        changePasswordBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                changePasswordBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        changePasswordPNL.add(changePasswordBTN, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        configTabPNL.add(changePasswordPNL, gridBagConstraints);

        resetStudentPasswordPNL.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(javax.swing.border.EtchedBorder.RAISED), "Reset Student Password"));
        resetStudentPasswordPNL.setLayout(new java.awt.GridBagLayout());

        resetPasswordBTN.setText("Reset Password");
        resetPasswordBTN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                resetPasswordBTNActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        resetStudentPasswordPNL.add(resetPasswordBTN, gridBagConstraints);

        eLProperty = org.jdesktop.beansbinding.ELProperty.create("${students}");
        jListBinding = org.jdesktop.swingbinding.SwingBindings.createJListBinding(org.jdesktop.beansbinding.AutoBinding.UpdateStrategy.READ, databaseManager, eLProperty, studentListLST);
        bindingGroup.addBinding(jListBinding);

        studentsSP.setViewportView(studentListLST);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        resetStudentPasswordPNL.add(studentsSP, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        configTabPNL.add(resetStudentPasswordPNL, gridBagConstraints);

        tabs.addTab("Configuration", configTabPNL);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
        gridBagConstraints.weightx = 1.0;
        gridBagConstraints.weighty = 1.0;
        getContentPane().add(tabs, gridBagConstraints);

        bindingGroup.bind();

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tabsStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_tabsStateChanged
        switch (tabs.getSelectedIndex()) {
            case 0:
                if (!databaseManager.isInitializedSPC()) {
                    databaseManager.initializeSPC();
                    databaseManager.setInitializedSPC(true);
                }
                databaseManager.addStudentSentinel();
                databaseManager.addCategorySentinel();
                databaseManager.addProfessorSentinel();
                databaseManager.removeProblemSentinel();
                databaseManager.removeClassSentinel();
                databaseManager.removeProblemCategorySentinel();
                databaseManager.removeProblemProfessorSentinel();
                databaseManager.removeClassProfessorSentinel();
                break;
            case 1:
                if (!databaseManager.isInitializedProblems()) {
                    databaseManager.initializeProblems();
                    databaseManager.setInitializedProblems(true);
                }
                databaseManager.addProblemSentinel();
                databaseManager.removeStudentSentinel();
                databaseManager.removeCategorySentinel();
                databaseManager.removeProfessorSentinel();
                databaseManager.removeClassSentinel();
                databaseManager.removeClassProfessorSentinel();
                break;
            case 2:
                if (!databaseManager.isInitializedClasses()) {
                    databaseManager.initializeClasses();
                    databaseManager.setInitializedClasses(true);
                }
                databaseManager.addClassSentinel();
                databaseManager.removeStudentSentinel();
                databaseManager.removeCategorySentinel();
                databaseManager.removeProfessorSentinel();
                databaseManager.removeProblemSentinel();
                databaseManager.removeProblemCategorySentinel();
                databaseManager.removeProblemProfessorSentinel();
                break;
            case 3:
                if (!databaseManager.isInitializedAttempts()) {
                    databaseManager.initializeAttempts();
                    databaseManager.setInitializedAttempts(true);
                }
                databaseManager.removeStudentSentinel();
                databaseManager.removeClassSentinel();
                databaseManager.removeCategorySentinel();
                databaseManager.removeProfessorSentinel();
                databaseManager.removeProblemSentinel();
                databaseManager.removeProblemCategorySentinel();
                databaseManager.removeProblemProfessorSentinel();

                break;
            case 4:
                if (!databaseManager.isInitializedConfig()) {
                    databaseManager.initializeConfig();
                    databaseManager.setInitializedConfig(true);
                }
                databaseManager.removeStudentSentinel();
                databaseManager.removeClassSentinel();
                databaseManager.removeCategorySentinel();
                databaseManager.removeProfessorSentinel();
                databaseManager.removeProblemSentinel();
                databaseManager.removeProblemCategorySentinel();
                databaseManager.removeProblemProfessorSentinel();
                break;
            default:
                System.err.println("No Tab Selected!");
        }
    }//GEN-LAST:event_tabsStateChanged

    private void categoryListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_categoryListValueChanged
        Category selectedCategory = (Category) categoryList.getSelectedValue();
        if (selectedCategory == null) {
            categoryNameTF.setFocusable(false);
            categoryDescriptionTA.setFocusable(false);
            categoryAddBTN.setEnabled(false);
            categoryDeleteBTN.setEnabled(false);
        } else {
            categoryNameTF.setFocusable(true);
            categoryDescriptionTA.setFocusable(true);
            categoryAddBTN.setEnabled(true);
            if (selectedCategory.isSentinel()) {
                categoryAddBTN.setText("Add");
                categoryDeleteBTN.setEnabled(false);
            } else {
                categoryAddBTN.setText("Edit");
                categoryDeleteBTN.setEnabled(true);
            }
        }
    }//GEN-LAST:event_categoryListValueChanged

    private void categoryNameTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_categoryNameTFFocusGained
        Category selectedCategory = (Category) categoryList.getSelectedValue();
        if (selectedCategory.isSentinel()) {
            categoryNameTF.selectAll();
        }
    }//GEN-LAST:event_categoryNameTFFocusGained

    private void categoryNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_categoryNameTFFocusLost
        categoryNameTF.select(0, 0);
    }//GEN-LAST:event_categoryNameTFFocusLost

    private void categoryDescriptionTAFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_categoryDescriptionTAFocusGained
        Category selectedCategory = (Category) categoryList.getSelectedValue();
        if (selectedCategory.isSentinel()) {
            categoryDescriptionTA.selectAll();
        }
    }//GEN-LAST:event_categoryDescriptionTAFocusGained

    private void categoryDescriptionTAFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_categoryDescriptionTAFocusLost
        categoryDescriptionTA.select(0, 0);
    }//GEN-LAST:event_categoryDescriptionTAFocusLost

    private void categoryAddBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_categoryAddBTNActionPerformed
        Category selectedCategory = (Category) categoryList.getSelectedValue();
        String categoryNameText = categoryNameTF.getText();
        String categoryDescriptionText = categoryDescriptionTA.getText();
        if (selectedCategory.isSentinel()) {
            if (categoryNameText.compareTo(selectedCategory.getName()) == 0 || categoryNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a category name.", "Category Name", JOptionPane.WARNING_MESSAGE);
            } else if (categoryDescriptionText.compareTo(selectedCategory.getDescription()) == 0 || categoryDescriptionText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a category description.", "Category Description", JOptionPane.WARNING_MESSAGE);
            } else {
                categoryList.setSelectedValue(databaseManager.createCategory(categoryNameText, categoryDescriptionText), true);
            }
        } else {
            if (categoryNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a category name.", "Category Name", JOptionPane.WARNING_MESSAGE);
            } else if (categoryDescriptionText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a category description.", "Category Description", JOptionPane.WARNING_MESSAGE);
            } else {
                categoryList.setSelectedValue(databaseManager.editCategory(selectedCategory, categoryNameText, categoryDescriptionText), true);
            }
        }
    }//GEN-LAST:event_categoryAddBTNActionPerformed

    private void categoryDeleteBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_categoryDeleteBTNActionPerformed
        Category selectedCategory = (Category) categoryList.getSelectedValue();
        if (selectedCategory.isSentinel()) {
            JOptionPane.showMessageDialog(this, "Cannot delete this choice.", "Category Deletion", JOptionPane.WARNING_MESSAGE);
            categoryList.setSelectedIndex(-1);
        } else if (!selectedCategory.getProblems().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Cannot delete " + selectedCategory + ", because this category is bound to existent problems.", "Category Deletion", JOptionPane.WARNING_MESSAGE);
        } else {
            int choice = JOptionPane.showConfirmDialog(this, selectedCategory + " --> Do you really want to permanently delete this category?", "Confirm Category Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (choice == 0) {
                databaseManager.deleteCategory(selectedCategory);
            } else if (choice != 1) {
                System.err.println("The dialog returned an invalid option.");
            }
        }
    }//GEN-LAST:event_categoryDeleteBTNActionPerformed

    private void studentLastNameTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_studentLastNameTFFocusGained
        Student selectedStudent = (Student) studentList.getSelectedValue();
        if (selectedStudent.isSentinel()) {
            studentLastNameTF.selectAll();
        }
    }//GEN-LAST:event_studentLastNameTFFocusGained

    private void studentLastNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_studentLastNameTFFocusLost
        studentLastNameTF.select(0, 0);
    }//GEN-LAST:event_studentLastNameTFFocusLost

    private void studentUserNameTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_studentUserNameTFFocusGained
        Student selectedStudent = (Student) studentList.getSelectedValue();
        if (selectedStudent.isSentinel()) {
            int lastNamePartLength = studentLastNameTF.getText().length();
            String lastNamePart;
            if (lastNamePartLength > 0) {
                lastNamePart = (studentLastNameTF.getText().length() < 6) ? studentLastNameTF.getText().substring(0) : studentLastNameTF.getText().substring(0, 6);
            } else {
                lastNamePart = "";
            }
            String firstNamePart = (studentFirstNameTF.getText().length() > 0) ? studentFirstNameTF.getText().substring(0, 1) : "";
            studentUserNameTF.setText((lastNamePart + firstNamePart).toLowerCase());
            studentUserNameTF.selectAll();
        }
    }//GEN-LAST:event_studentUserNameTFFocusGained

    private void studentUserNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_studentUserNameTFFocusLost
        studentUserNameTF.select(0, 0);
    }//GEN-LAST:event_studentUserNameTFFocusLost

    private void studentListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_studentListValueChanged
        Student selectedStudent = (Student) studentList.getSelectedValue();
        if (selectedStudent == null) {
            studentFirstNameTF.setFocusable(false);
            studentLastNameTF.setFocusable(false);
            studentUserNameTF.setFocusable(false);
            studentAddBTN.setEnabled(false);
            studentDeleteBTN.setEnabled(false);
        } else {
            studentFirstNameTF.setFocusable(true);
            studentLastNameTF.setFocusable(true);
            studentUserNameTF.setFocusable(true);
            studentAddBTN.setEnabled(true);
            if (selectedStudent.isSentinel()) {
                studentAddBTN.setText("Add");
                studentDeleteBTN.setEnabled(false);
            } else {
                studentAddBTN.setText("Edit");
                studentDeleteBTN.setEnabled(true);
            }
        }

    }//GEN-LAST:event_studentListValueChanged

    private void studentAddBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_studentAddBTNActionPerformed
        Student selectedStudent = (Student) studentList.getSelectedValue();
        String studentFirstNameText = studentFirstNameTF.getText();
        String studentLastNameText = studentLastNameTF.getText();
        String studentUserNameText = studentUserNameTF.getText();
        if (selectedStudent.isSentinel()) {
            if (studentFirstNameText.compareTo(selectedStudent.getFirstName()) == 0 || studentFirstNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter student's first name.", "Student First Name", JOptionPane.WARNING_MESSAGE);
            } else if (studentLastNameText.compareTo(selectedStudent.getLastName()) == 0 || studentLastNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a student's last name.", "Student Last Name", JOptionPane.WARNING_MESSAGE);
            } else if (studentUserNameText.compareTo(selectedStudent.getUserName()) == 0 || studentUserNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a student's username.", "Student Log In Name", JOptionPane.WARNING_MESSAGE);
            } else {
                studentList.setSelectedValue(databaseManager.createStudent(studentFirstNameText, studentLastNameText, studentUserNameText), true);
            }
        } else {
            if (studentFirstNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter student's first name.", "Student First Name", JOptionPane.WARNING_MESSAGE);
            } else if (studentLastNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a student's last name.", "Student Last Name", JOptionPane.WARNING_MESSAGE);
            } else if (studentUserNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a student's username.", "Student Log In Name", JOptionPane.WARNING_MESSAGE);
            } else {
                studentList.setSelectedValue(databaseManager.editStudent(selectedStudent, studentFirstNameText, studentLastNameText, studentUserNameText), true);
            }
        }
    }//GEN-LAST:event_studentAddBTNActionPerformed

    private void studentDeleteBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_studentDeleteBTNActionPerformed
        Student selectedStudent = (Student) studentList.getSelectedValue();
        if (selectedStudent.isSentinel()) {
            JOptionPane.showMessageDialog(this, "Cannot delete this choice.", "Student Deletion", JOptionPane.WARNING_MESSAGE);
            studentList.setSelectedIndex(-1);
        } else if (!selectedStudent.getEnrollment().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Cannot delete " + selectedStudent + ", because he / she is curently enrolled.", "Student Deletion", JOptionPane.WARNING_MESSAGE);
        } else {
            int choice = JOptionPane.showConfirmDialog(this, selectedStudent + " --> Do you really want to permanently delete this student?", "Confirm Student Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (choice == 0) {
                databaseManager.deleteStudent(selectedStudent);
            } else if (choice != 1) {
                System.err.println("The dialog returned an invalid option.");
            }
        }
    }//GEN-LAST:event_studentDeleteBTNActionPerformed

    private void professorListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_professorListValueChanged
        Professor selectedProfessor = (Professor) professorList.getSelectedValue();
        if (selectedProfessor == null) {
            professorFirstNameTF.setFocusable(false);
            professorLastNameTF.setFocusable(false);
            professorAddBTN.setEnabled(false);
            professorUserNameTF.setFocusable(false);
            professorDeleteBTN.setEnabled(false);
        } else {
            professorFirstNameTF.setFocusable(true);
            professorLastNameTF.setFocusable(true);
            professorUserNameTF.setFocusable(true);
            professorAddBTN.setEnabled(true);
            if (selectedProfessor.isSentinel()) {
                professorAddBTN.setText("Add");
                professorDeleteBTN.setEnabled(false);
            } else {
                professorAddBTN.setText("Edit");
                professorDeleteBTN.setEnabled(true);
            }
        }
    }//GEN-LAST:event_professorListValueChanged

    private void professorFirstNameTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_professorFirstNameTFFocusGained
        Professor selectedProfessor = (Professor) professorList.getSelectedValue();
        if (selectedProfessor.isSentinel()) {
            professorFirstNameTF.selectAll();
        }
    }//GEN-LAST:event_professorFirstNameTFFocusGained

    private void professorFirstNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_professorFirstNameTFFocusLost
        professorFirstNameTF.select(0, 0);
    }//GEN-LAST:event_professorFirstNameTFFocusLost

    private void professorLastNameTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_professorLastNameTFFocusGained
        Professor selectedProfessor = (Professor) professorList.getSelectedValue();
        if (selectedProfessor.isSentinel()) {
            professorLastNameTF.selectAll();
        }
    }//GEN-LAST:event_professorLastNameTFFocusGained

    private void professorLastNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_professorLastNameTFFocusLost
        professorLastNameTF.select(0, 0);
    }//GEN-LAST:event_professorLastNameTFFocusLost

    private void professorAddBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_professorAddBTNActionPerformed
        Professor selectedProfessor = (Professor) professorList.getSelectedValue();
        String professorFirstNameText = professorFirstNameTF.getText();
        String professorLastNameText = professorLastNameTF.getText();
        String professorUserNameText = professorUserNameTF.getText();
        if (selectedProfessor.isSentinel()) {
            if (professorFirstNameText.compareTo(selectedProfessor.getFirstName()) == 0 || professorFirstNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter professor's first name.", "Professor First Name", JOptionPane.WARNING_MESSAGE);
            } else if (professorLastNameText.compareTo(selectedProfessor.getLastName()) == 0 || professorLastNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a professor's last name.", "Professor Last Name", JOptionPane.WARNING_MESSAGE);
            } else {
                professorList.setSelectedValue(databaseManager.createProfessor(professorFirstNameText, professorLastNameText, professorUserNameText), true);
            }
        } else {
            if (professorFirstNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter professor's first name.", "Professor First Name", JOptionPane.WARNING_MESSAGE);
            } else if (professorLastNameText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a professor's last name.", "Professor Last Name", JOptionPane.WARNING_MESSAGE);
            } else {
                professorList.setSelectedValue(databaseManager.editProfessor(selectedProfessor, professorFirstNameText, professorLastNameText, professorUserNameText), true);
            }
        }
    }//GEN-LAST:event_professorAddBTNActionPerformed

    private void professorDeleteBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_professorDeleteBTNActionPerformed
        Professor selectedProfessor = (Professor) professorList.getSelectedValue();
        if (selectedProfessor.isSentinel()) {
            JOptionPane.showMessageDialog(this, "Cannot delete this choice.", "Professor Deletion", JOptionPane.WARNING_MESSAGE);
            professorList.setSelectedIndex(-1);
        } else if (!selectedProfessor.getClasses().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Cannot delete " + selectedProfessor + ", because he / she is listed as teaching.", "Professor Deletion", JOptionPane.WARNING_MESSAGE);
        } else if (!selectedProfessor.getProblems().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Cannot delete " + selectedProfessor + ", because he / she is listed as author.", "Professor Deletion", JOptionPane.WARNING_MESSAGE);
        } else {
            int choice = JOptionPane.showConfirmDialog(this, selectedProfessor + " --> Do you really want to permanently delete this professor?", "Confirm Professor Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (choice == 0) {
                databaseManager.deleteProfessor(selectedProfessor);
            } else if (choice != 1) {
                System.err.println("The dialog returned an invalid option.");
            }
        }
    }//GEN-LAST:event_professorDeleteBTNActionPerformed

    private void problemListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_problemListValueChanged
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem == null) {
            titleTF.setFocusable(false);
            categoryCB.setSelectedIndex(-1);
            categoryCB.setEnabled(false);
            authorCB.setSelectedIndex(-1);
            authorCB.setEnabled(false);
            problemAddBTN.setEnabled(false);
            problemDeleteBTN.setEnabled(false);
            descriptionTA.setFocusable(false);
            upperCodeTA.setFocusable(false);
            lowerCodeTA.setFocusable(false);
            inputTA.setFocusable(false);
            outputTA.setFocusable(false);
        } else {
            titleTF.setFocusable(true);
            categoryCB.setEnabled(true);
            authorCB.setEnabled(true);
            problemAddBTN.setEnabled(true);
            descriptionTA.setFocusable(true);
            upperCodeTA.setFocusable(true);
            lowerCodeTA.setFocusable(true);
            inputTA.setFocusable(true);
            outputTA.setFocusable(true);
            if (selectedProblem.isSentinel()) {
                problemAddBTN.setText("Add");
                problemDeleteBTN.setEnabled(false);
                databaseManager.addProblemCategorySentinel();
                databaseManager.addProblemProfessorSentinel();
            } else {
                problemAddBTN.setText("Edit");
                problemDeleteBTN.setEnabled(true);
                databaseManager.removeProblemCategorySentinel();
                databaseManager.removeProblemProfessorSentinel();
            }
        }
    }//GEN-LAST:event_problemListValueChanged

    private void titleTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_titleTFFocusGained
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem.isSentinel()) {
            titleTF.selectAll();
        }
    }//GEN-LAST:event_titleTFFocusGained

    private void titleTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_titleTFFocusLost
        titleTF.select(0, 0);
    }//GEN-LAST:event_titleTFFocusLost

    private void descriptionTAFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_descriptionTAFocusGained
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem.isSentinel()) {
            descriptionTA.selectAll();
        }
    }//GEN-LAST:event_descriptionTAFocusGained

    private void descriptionTAFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_descriptionTAFocusLost
        descriptionTA.select(0, 0);
    }//GEN-LAST:event_descriptionTAFocusLost

    private void upperCodeTAFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_upperCodeTAFocusGained
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem.isSentinel()) {
            upperCodeTA.selectAll();
        }
    }//GEN-LAST:event_upperCodeTAFocusGained

    private void upperCodeTAFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_upperCodeTAFocusLost
        upperCodeTA.select(0, 0);
    }//GEN-LAST:event_upperCodeTAFocusLost

    private void lowerCodeTAFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_lowerCodeTAFocusGained
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem.isSentinel()) {
            lowerCodeTA.selectAll();
        }
    }//GEN-LAST:event_lowerCodeTAFocusGained

    private void lowerCodeTAFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_lowerCodeTAFocusLost
        lowerCodeTA.select(0, 0);
    }//GEN-LAST:event_lowerCodeTAFocusLost

    private void inputTAFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputTAFocusGained
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem.isSentinel()) {
            inputTA.selectAll();
        }
    }//GEN-LAST:event_inputTAFocusGained

    private void inputTAFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_inputTAFocusLost
        inputTA.select(0, 0);
    }//GEN-LAST:event_inputTAFocusLost

    private void outputTAFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_outputTAFocusGained
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem.isSentinel()) {
            outputTA.selectAll();
        }
    }//GEN-LAST:event_outputTAFocusGained

    private void outputTAFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_outputTAFocusLost
        outputTA.select(0, 0);
    }//GEN-LAST:event_outputTAFocusLost

    private void problemAddBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_problemAddBTNActionPerformed
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        String problemTitleText = titleTF.getText();
        Category problemCategory = (Category) categoryCB.getSelectedItem();
        Professor problemAuthor = (Professor) authorCB.getSelectedItem();
        String problemDescriptionText = descriptionTA.getText();
        String problemUpperCodeText = upperCodeTA.getText();
        String problemLowerCodeText = lowerCodeTA.getText();
        String problemInputText = inputTA.getText();
        String problemOutputText = outputTA.getText();
        if (selectedProblem.isSentinel()) {
            if (problemTitleText.compareTo(selectedProblem.getName()) == 0 || problemTitleText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a problem title.", "Problem Title", JOptionPane.WARNING_MESSAGE);
            } else if (problemCategory.toString().compareTo(selectedProblem.getCategory().toString()) == 0) {
                JOptionPane.showMessageDialog(this, "Please choose a problem category.", "Problem Category", JOptionPane.WARNING_MESSAGE);
            } else if (problemAuthor.toString().compareTo(selectedProblem.getAuthor().toString()) == 0) {
                JOptionPane.showMessageDialog(this, "Please choose a problem author.", "Problem Author", JOptionPane.WARNING_MESSAGE);
            } else if (problemDescriptionText.compareTo(selectedProblem.getDescription()) == 0 || problemDescriptionText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a problem description.", "Problem Description", JOptionPane.WARNING_MESSAGE);
            } else if (problemUpperCodeText.compareTo(selectedProblem.getUpperCode()) == 0 || problemUpperCodeText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter some upper code for this problem.", "Problem Upper Code", JOptionPane.WARNING_MESSAGE);
            } else if (problemLowerCodeText.compareTo(selectedProblem.getLowerCode()) == 0 || problemLowerCodeText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter some lower code for this problem.", "Problem Lower Code", JOptionPane.WARNING_MESSAGE);
            } else {
                if (problemInputText.compareTo(selectedProblem.getInputData()) == 0) {
                    problemInputText = "";
                }
                if (problemOutputText.compareTo(selectedProblem.getOutputData()) == 0) {
                    problemOutputText = "";
                }
                problemList.setSelectedValue(databaseManager.createProblem(problemTitleText, problemAuthor, problemCategory, problemDescriptionText, problemUpperCodeText + "\n" + CodeRunner.PLACEHOLDER + "\n" + problemLowerCodeText, problemInputText, problemOutputText), true);
            }
        } else {
            if (problemTitleText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a problem title.", "Problem Title", JOptionPane.WARNING_MESSAGE);
            } else if (problemDescriptionText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a problem description.", "Problem Description", JOptionPane.WARNING_MESSAGE);
            } else if (problemUpperCodeText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter some upper code for this problem.", "Problem Upper Code", JOptionPane.WARNING_MESSAGE);
            } else if (problemLowerCodeText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter some lower code for this problem.", "Problem Lower Code", JOptionPane.WARNING_MESSAGE);
            } else {
                problemList.setSelectedValue(databaseManager.editProblem(selectedProblem, problemTitleText, problemAuthor, problemCategory, problemDescriptionText, problemUpperCodeText + "\n" + CodeRunner.PLACEHOLDER + "\n" + problemLowerCodeText, problemInputText, problemOutputText), true);
            }
        }
    }//GEN-LAST:event_problemAddBTNActionPerformed

    private void problemDeleteBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_problemDeleteBTNActionPerformed
        Problem selectedProblem = (Problem) problemList.getSelectedValue();
        if (selectedProblem.isSentinel()) {
            JOptionPane.showMessageDialog(this, "Cannot delete this choice.", "Problem Deletion", JOptionPane.WARNING_MESSAGE);
            problemList.setSelectedIndex(-1);
        } else if (!selectedProblem.getClasses().isEmpty()) {
            JOptionPane.showMessageDialog(this, "Cannot delete " + selectedProblem + ", because it is assigned to a class.", "Problem Deletion", JOptionPane.WARNING_MESSAGE);
        } else {
            int choice = JOptionPane.showConfirmDialog(this, selectedProblem + " --> Do you really want to permanently delete this problem?", "Confirm Problem Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (choice == 0) {
                databaseManager.deleteProblem(selectedProblem);
            } else if (choice != 1) {
                System.err.println("The dialog returned an invalid option.");
            }
        }
    }//GEN-LAST:event_problemDeleteBTNActionPerformed

    private void classesListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_classesListValueChanged
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        if (selectedClass == null) {
            classTitleTF.setFocusable(false);
            classSemesterTF.setFocusable(false);
            classYearTF.setFocusable(false);
            classProfessorCB.setSelectedIndex(-1);
            classProfessorCB.setEnabled(false);
            classesAddBTN.setEnabled(false);
            classesDeleteBTN.setEnabled(false);
            assignedProblems.setEnabled(false);
            assignProblemsBTN.setEnabled(false);
            removeProblemsBTN.setEnabled(false);
            enrolledStudents.setEnabled(false);
            enrollStudentsBTN.setEnabled(false);
            removeStudentsBTN.setEnabled(false);
        } else {
            classTitleTF.setFocusable(true);
            classSemesterTF.setFocusable(true);
            classYearTF.setFocusable(true);
            classProfessorCB.setEnabled(true);
            classesAddBTN.setEnabled(true);
            if (selectedClass.isSentinel()) {
                classesAddBTN.setText("Add");
                classesDeleteBTN.setEnabled(false);
                assignedProblems.setEnabled(false);
                assignProblemsBTN.setEnabled(false);
                removeProblemsBTN.setEnabled(false);
                enrolledStudents.setEnabled(false);
                enrollStudentsBTN.setEnabled(false);
                removeStudentsBTN.setEnabled(false);
                databaseManager.addClassProfessorSentinel();
            } else {
                classesAddBTN.setText("Edit");
                classesDeleteBTN.setEnabled(true);
                assignedProblems.setEnabled(true);
                assignProblemsBTN.setEnabled(true);
                removeProblemsBTN.setEnabled(true);
                enrolledStudents.setEnabled(true);
                enrollStudentsBTN.setEnabled(true);
                removeStudentsBTN.setEnabled(true);
                databaseManager.removeClassProfessorSentinel();
            }
        }
    }//GEN-LAST:event_classesListValueChanged

    private void classTitleTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_classTitleTFFocusGained
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        if (selectedClass.isSentinel()) {
            classTitleTF.selectAll();
        }
    }//GEN-LAST:event_classTitleTFFocusGained

    private void classTitleTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_classTitleTFFocusLost
        classTitleTF.select(0, 0);
    }//GEN-LAST:event_classTitleTFFocusLost

    private void classSemesterTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_classSemesterTFFocusGained
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        if (selectedClass.isSentinel()) {
            classSemesterTF.selectAll();
        }
    }//GEN-LAST:event_classSemesterTFFocusGained

    private void classSemesterTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_classSemesterTFFocusLost
        classSemesterTF.select(0, 0);
    }//GEN-LAST:event_classSemesterTFFocusLost

    private void classYearTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_classYearTFFocusGained
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        if (selectedClass.isSentinel()) {
            classYearTF.selectAll();
        }
    }//GEN-LAST:event_classYearTFFocusGained

    private void classYearTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_classYearTFFocusLost
        classYearTF.select(0, 0);
    }//GEN-LAST:event_classYearTFFocusLost

    private void classesAddBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classesAddBTNActionPerformed
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        String classTitleText = classTitleTF.getText();
        String classSemesterText = classSemesterTF.getText();
        Integer classYear = null;
        boolean yearIsGood = true;
        try {
            classYear = Integer.parseInt(classYearTF.getText());
        } catch (NumberFormatException ex) {
            yearIsGood = false;
        }
        Professor classProfessor = (Professor) classProfessorCB.getSelectedItem();
        if (selectedClass.isSentinel()) {
            if (classTitleText.compareTo(selectedClass.getTitle()) == 0 || classTitleText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a class title.", "Class Title", JOptionPane.WARNING_MESSAGE);
            } else if (classSemesterText.compareTo(selectedClass.getSemester()) == 0 || classTitleText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a class semester.", "Class Semester", JOptionPane.WARNING_MESSAGE);
            } else if (!yearIsGood) {
                JOptionPane.showMessageDialog(this, "Please enter a valid class year.", "Class Year", JOptionPane.WARNING_MESSAGE);
            } else if (classProfessor.toString().compareTo(selectedClass.getProfessor().toString()) == 0) {
                JOptionPane.showMessageDialog(this, "Please choose a class professor.", "Class Professor", JOptionPane.WARNING_MESSAGE);
            } else {
                classesList.setSelectedValue(databaseManager.createClass(classTitleText, classSemesterText, classYear, classProfessor), true);
            }
        } else {
            if (classTitleText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a class title.", "Class Title", JOptionPane.WARNING_MESSAGE);
            } else if (classTitleText.compareTo("") == 0) {
                JOptionPane.showMessageDialog(this, "Please enter a class semester.", "Class Semester", JOptionPane.WARNING_MESSAGE);
            } else if (!yearIsGood) {
                JOptionPane.showMessageDialog(this, "Please enter a valid class year.", "Class Year", JOptionPane.WARNING_MESSAGE);
            } else {
                classesList.setSelectedValue(databaseManager.editClass(selectedClass, classTitleText, classSemesterText, classYear, classProfessor), true);
            }
        }
    }//GEN-LAST:event_classesAddBTNActionPerformed

    private void classesDeleteBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_classesDeleteBTNActionPerformed
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        if (selectedClass.isSentinel()) {
            JOptionPane.showMessageDialog(this, "Cannot delete this choice.", "Class Deletion", JOptionPane.WARNING_MESSAGE);
            classesList.setSelectedIndex(-1);
        } else {
            int choice = JOptionPane.showConfirmDialog(this, selectedClass + " --> Do you really want to permanently delete this class?", "Confirm Class Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
            if (choice == 0) {
                databaseManager.deleteClass(selectedClass);
            } else if (choice != 1) {
                System.err.println("The dialog returned an invalid option.");
            }
        }
    }//GEN-LAST:event_classesDeleteBTNActionPerformed

    private void assignProblemsBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_assignProblemsBTNActionPerformed
        List<Problem> selectedProblems = new Vector<Problem>();
        for (Object someObject : problemsPool.getSelectedValues()) {
            selectedProblems.add((Problem) someObject);
        }
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        selectedProblems.removeAll(selectedClass.getProblems());
        classesList.setSelectedIndex(classesList.getSelectedIndex() - 1);
        classesList.setSelectedValue(databaseManager.assignProblems(selectedClass, selectedProblems), true);
    }//GEN-LAST:event_assignProblemsBTNActionPerformed

    private void removeProblemsBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeProblemsBTNActionPerformed
        List<Problem> selectedAssignedProblems = new Vector<Problem>();
        for (Object someObject : assignedProblems.getSelectedValues()) {
            selectedAssignedProblems.add((Problem) someObject);
        }
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        classesList.setSelectedIndex(classesList.getSelectedIndex() - 1);
        classesList.setSelectedValue(databaseManager.removeProblems(selectedClass, selectedAssignedProblems), true);
    }//GEN-LAST:event_removeProblemsBTNActionPerformed

    private void enrollStudentsBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enrollStudentsBTNActionPerformed
        List<Student> selectedStudents = new Vector<Student>();
        for (Object someObject : studentsPool.getSelectedValues()) {
            selectedStudents.add((Student) someObject);
        }
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        selectedStudents.removeAll(selectedClass.getStudents());
        classesList.setSelectedIndex(classesList.getSelectedIndex() - 1);
        classesList.setSelectedValue(databaseManager.enrollStudents(selectedClass, selectedStudents), true);
    }//GEN-LAST:event_enrollStudentsBTNActionPerformed

    private void removeStudentsBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeStudentsBTNActionPerformed
        List<Student> selectedEnrolledStudents = new Vector<Student>();
        for (Object someObject : enrolledStudents.getSelectedValues()) {
            selectedEnrolledStudents.add((Student) someObject);
        }
        cayenne.DBobjects.Class selectedClass = (cayenne.DBobjects.Class) classesList.getSelectedValue();
        classesList.setSelectedIndex(classesList.getSelectedIndex() - 1);
        classesList.setSelectedValue(databaseManager.removeStudents(selectedClass, selectedEnrolledStudents), true);
    }//GEN-LAST:event_removeStudentsBTNActionPerformed

    private void studentFirstNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_studentFirstNameTFFocusLost
        studentFirstNameTF.select(0, 0);
}//GEN-LAST:event_studentFirstNameTFFocusLost

    private void studentFirstNameTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_studentFirstNameTFFocusGained
        Student selectedStudent = (Student) studentList.getSelectedValue();
        if (selectedStudent.isSentinel()) {
            studentFirstNameTF.selectAll();
        }
}//GEN-LAST:event_studentFirstNameTFFocusGained

    private void professorUserNameTFFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_professorUserNameTFFocusGained
        Professor selectedProfessor = (Professor) professorList.getSelectedValue();
        if (selectedProfessor.isSentinel()) {
            int lastNamePartLength = professorLastNameTF.getText().length();
            String lastNamePart;
            if (lastNamePartLength > 0) {
                lastNamePart = (professorLastNameTF.getText().length() < 6) ? professorLastNameTF.getText().substring(0) : professorLastNameTF.getText().substring(0, 6);
            } else {
                lastNamePart = "";
            }
            String firstNamePart = (professorFirstNameTF.getText().length() > 0) ? professorFirstNameTF.getText().substring(0, 1) : "";
            professorUserNameTF.setText((lastNamePart + firstNamePart).toLowerCase());
            professorUserNameTF.selectAll();
        }
    }//GEN-LAST:event_professorUserNameTFFocusGained

    private void professorUserNameTFFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_professorUserNameTFFocusLost
        professorUserNameTF.select(0, 0);
    }//GEN-LAST:event_professorUserNameTFFocusLost

    private void logInBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logInBTNActionPerformed
        LogInCondition condition = databaseManager.logInProfessor(usernameTF.getText(), new String(passwordPF.getPassword()));
        switch (condition) {
            case INVALID_CREDENTIALS:
                logInStatusLBL.setForeground(Color.RED);
                logInStatusLBL.setText("Invalid credentials.");
                break;
            case PROFESSOR:
                logInStatusLBL.setForeground(Color.BLACK);
                logInStatusLBL.setText("Log In Successful!");
                logInDialog.setVisible(false);
                break;
            case JACKALOPE:
                logInStatusLBL.setForeground(Color.BLACK);
                logInStatusLBL.setText("Log In As Super User");
                logInDialog.setVisible(false);
                break;
            default:
                System.err.println("logInProfessor() returned " + condition + " --> this should be impossible!");
                System.exit(-1);
        }
    }//GEN-LAST:event_logInBTNActionPerformed

    private void changePasswordBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changePasswordBTNActionPerformed
        if (Arrays.equals(newPasswordPF.getPassword(), newPassword2PF.getPassword())) {
            boolean pass = databaseManager.changeProfessorPassword(currentPasswordPF.getPassword(), newPasswordPF.getPassword());
            if (pass == false) {
                JOptionPane.showMessageDialog(this, "Wrong Current Password!", "Password Change Failed", JOptionPane.WARNING_MESSAGE);
            }
            currentPasswordPF.setText("");
            newPasswordPF.setText("");
            newPassword2PF.setText("");
            JOptionPane.showMessageDialog(this, "Your password was changed, please remember it.", "Password Changed", JOptionPane.INFORMATION_MESSAGE);
        } else {
            JOptionPane.showMessageDialog(this, "New Passwords Don't Match!", "Password Change Failed", JOptionPane.WARNING_MESSAGE);
        }
    }//GEN-LAST:event_changePasswordBTNActionPerformed

    private void resetPasswordBTNActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resetPasswordBTNActionPerformed
        Student stud = (Student) studentListLST.getSelectedValue();
        databaseManager.resetStudentPassword(stud);
        JOptionPane.showMessageDialog(this, stud.getFirstName() + " " + stud.getLastName() + "\'s password has been reset." + "\n(The default password is blank.)", "Student Password Reset", JOptionPane.INFORMATION_MESSAGE);
    }//GEN-LAST:event_resetPasswordBTNActionPerformed

    private void attemptTabStudentsLSTValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_attemptTabStudentsLSTValueChanged

    }//GEN-LAST:event_attemptTabStudentsLSTValueChanged

    private void logInDialogWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_logInDialogWindowClosed
        System.exit(0);
    }//GEN-LAST:event_logInDialogWindowClosed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
                new XIntShell().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton assignProblemsBTN;
    private javax.swing.JList assignedProblems;
    private javax.swing.JScrollPane assignedProblemsSP;
    private xidb.AttemptController attemptController;
    private javax.swing.JList attemptTabAttemptLST;
    private javax.swing.JScrollPane attemptTabAttemptSP;
    private javax.swing.JScrollPane attemptTabCauseSP;
    private javax.swing.JTextArea attemptTabCauseTA;
    private javax.swing.JList attemptTabClassesLST;
    private javax.swing.JScrollPane attemptTabClassesSP;
    private javax.swing.JScrollPane attemptTabCodeSP;
    private javax.swing.JTextArea attemptTabCodeTA;
    private javax.swing.JPanel attemptTabPNL;
    private javax.swing.JList attemptTabProblemsLST;
    private javax.swing.JScrollPane attemptTabProblemsSP;
    private javax.swing.JList attemptTabStudentsLST;
    private javax.swing.JScrollPane attemptTabStudentsSP;
    private javax.swing.JComboBox authorCB;
    private javax.swing.JLabel authorLBL;
    private javax.swing.JPanel availableProblemsPNL;
    private javax.swing.JButton categoryAddBTN;
    private javax.swing.JPanel categoryAddDeletePNL;
    private javax.swing.JComboBox categoryCB;
    private javax.swing.JButton categoryDeleteBTN;
    private javax.swing.JScrollPane categoryDescriptionSP;
    private javax.swing.JTextArea categoryDescriptionTA;
    private javax.swing.JPanel categoryInfoPNL;
    private javax.swing.JLabel categoryLBL;
    private javax.swing.JList categoryList;
    private javax.swing.JScrollPane categoryListSP;
    private javax.swing.JLabel categoryNameLBL;
    private javax.swing.JTextField categoryNameTF;
    private javax.swing.JButton changePasswordBTN;
    private javax.swing.JPanel changePasswordPNL;
    private javax.swing.JPanel classInfoPNL;
    private javax.swing.JComboBox classProfessorCB;
    private javax.swing.JLabel classProfessorTF;
    private javax.swing.JLabel classSemesterLBL;
    private javax.swing.JTextField classSemesterTF;
    private javax.swing.JLabel classTitleLBL;
    private javax.swing.JTextField classTitleTF;
    private javax.swing.JLabel classYearLBL;
    private javax.swing.JTextField classYearTF;
    private javax.swing.JButton classesAddBTN;
    private javax.swing.JButton classesDeleteBTN;
    private javax.swing.JList classesList;
    private javax.swing.JScrollPane classesSP;
    private javax.swing.JPanel classesTabPNL;
    private javax.swing.JPanel configTabPNL;
    private javax.swing.JLabel currentPasswordLBL;
    private javax.swing.JPasswordField currentPasswordPF;
    private xidb.DBManager databaseManager;
    private javax.swing.JScrollPane descriptionSP;
    private javax.swing.JTextArea descriptionTA;
    private javax.swing.JButton enrollStudentsBTN;
    private javax.swing.JList enrolledStudents;
    private javax.swing.JScrollPane enrolledStudentsSP;
    private javax.swing.JScrollPane inputSP;
    private javax.swing.JTextArea inputTA;
    private javax.swing.JButton logInBTN;
    private javax.swing.JDialog logInDialog;
    private javax.swing.JLabel logInStatusLBL;
    private javax.swing.JScrollPane lowerCodeSP;
    private javax.swing.JTextArea lowerCodeTA;
    private javax.swing.JLabel newPassword2LBL;
    private javax.swing.JPasswordField newPassword2PF;
    private javax.swing.JLabel newPasswordLBL;
    private javax.swing.JPasswordField newPasswordPF;
    private javax.swing.JScrollPane outputSP;
    private javax.swing.JTextArea outputTA;
    private javax.swing.JLabel passwordLBL;
    private javax.swing.JPasswordField passwordPF;
    private javax.swing.JButton problemAddBTN;
    private javax.swing.JPanel problemAddDeletePNL;
    private javax.swing.JComboBox problemCategoryCB;
    private javax.swing.JButton problemDeleteBTN;
    private javax.swing.JPanel problemInfoPNL;
    private javax.swing.JList problemList;
    private javax.swing.JScrollPane problemListSP;
    private javax.swing.JList problemsPool;
    private javax.swing.JScrollPane problemsPoolSP;
    private javax.swing.JPanel problemsTabPNL;
    private javax.swing.JButton professorAddBTN;
    private javax.swing.JPanel professorAddDeletePNL;
    private javax.swing.JButton professorDeleteBTN;
    private javax.swing.JLabel professorFirstNameLBL;
    private javax.swing.JTextField professorFirstNameTF;
    private javax.swing.JPanel professorInfoPNL;
    private javax.swing.JLabel professorLastNameLBL;
    private javax.swing.JTextField professorLastNameTF;
    private javax.swing.JList professorList;
    private javax.swing.JScrollPane professorListSP;
    private javax.swing.JLabel professorUserNameLBL;
    private javax.swing.JTextField professorUserNameTF;
    private javax.swing.JButton removeProblemsBTN;
    private javax.swing.JButton removeStudentsBTN;
    private javax.swing.JButton resetPasswordBTN;
    private javax.swing.JPanel resetStudentPasswordPNL;
    private javax.swing.JPanel scpTabPNL;
    private javax.swing.JButton studentAddBTN;
    private javax.swing.JPanel studentAddDeletePNL;
    private javax.swing.JButton studentDeleteBTN;
    private javax.swing.JLabel studentFirstNameLBL;
    private javax.swing.JTextField studentFirstNameTF;
    private javax.swing.JPanel studentInfoPNL;
    private javax.swing.JLabel studentLastNameLBL;
    private javax.swing.JTextField studentLastNameTF;
    private javax.swing.JList studentList;
    private javax.swing.JList studentListLST;
    private javax.swing.JScrollPane studentListSP;
    private javax.swing.JLabel studentUserNameLBL;
    private javax.swing.JTextField studentUserNameTF;
    private javax.swing.JList studentsPool;
    private javax.swing.JScrollPane studentsPoolSP;
    private javax.swing.JScrollPane studentsSP;
    private javax.swing.JTabbedPane tabs;
    private javax.swing.JLabel titleLBL;
    private javax.swing.JTextField titleTF;
    private javax.swing.JScrollPane upperCodeSP;
    private javax.swing.JTextArea upperCodeTA;
    private javax.swing.JLabel usernameLBL;
    private javax.swing.JTextField usernameTF;
    private org.jdesktop.beansbinding.BindingGroup bindingGroup;
    // End of variables declaration//GEN-END:variables
}
